package com.sky.controller.user;

import com.sky.Service.CategoryService;
import com.sky.entity.Category;
import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "用户端-分类管理")
@RestController(value = "userCategoryController")
@RequestMapping("/user/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @ApiOperation("获取分类列表")
    @GetMapping("/list")
    public Result<List<Category>> getCategoryList(Integer[] type) {
        //查询redis中是否有菜品数据
        //如果存在，直接返回，无需查询数据库
        //如果不存在，则查询数据库，并将查询到的数据存入redis
        // System.out.println("type="+type.toString());
        List<Category> categoryList = categoryService.getCategoryList(type);
        return Result.success(categoryList);
    }
}



















